<?php
include_once('header.php');

// IF INPUTING STOPWORDS
if (isset($_POST['stopword']) && !empty($_POST['stopword']))
{
	// get stopwords from post
	$stopword = $_POST['stopword'];
	$stopword = trim($stopword);
	$stopword = strtolower($stopword);
	// breat into array
	$stopword = str_replace("\n", ',', $stopword);
	$stopword = explode(',', $stopword);
	
	// save all stopwords
	include_once LIBRARY_DIRECTORY . 'StopwordManagement.php';
	$management = new StopwordManagement($stopword);
	$management->saveStopword();
	
	// reidrect to this page to avoid F5 key problem
	header("Location: input_stopword.php");
}

$SMARTY->display('input_stopword.tpl');